package com.xiao.wiki.controller;

import com.xiao.wiki.resp.CommonResp;
import com.xiao.wiki.resp.StatisticResp;
import com.xiao.wiki.service.EbookSnapshotService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ：降蓝
 * @description：
 * @date ：2022/9/21 22:55
 */
@RestController
@RequestMapping("/ebookSnapshot")
public class EbookSnapshotController {
    @Resource
    private EbookSnapshotService ebookSnapshotService;


    @GetMapping("/getStatistic")
    public CommonResp getStatistic() {
        CommonResp commonResp = new CommonResp();
        commonResp.setContent(ebookSnapshotService.getStatistic());
        return commonResp;
    }

    @GetMapping("/get-30-statistic")
    public CommonResp get30Statistic() {
        List<StatisticResp> statisticResp = ebookSnapshotService.get30Statistic();
        CommonResp<List<StatisticResp>> commonResp = new CommonResp<>();
        commonResp.setContent(statisticResp);

        return commonResp;
    }
}
